import jwt from "jsonwebtoken";
import { JWT_KEY, JWT_EXPIRED } from "../config/code";

export const setToken = (username: string, time?: string) => {
  const token = jwt.sign({ header: username }, JWT_KEY, {
    expiresIn: time || JWT_EXPIRED,
  });
  return token;
};


export const getToken = (token: string) => {
    const data = jwt.verify(token, JWT_KEY);
    return data

};
